package com.uzai.common.enums;

/**
 * @Auther: xiaoyuexl
 * @Date: 2021/8/16 16:50
 * @Description: 支付方式
 */
public enum PaymentTypeEnum {
    /**
     * 免费(试用)
     */
    PAY_FREE(0,"免费"),

    /**
     * 卡密支付
     */
    PAY_CARDID(1,"卡密支付"),

    /**
     * 在线支付-支付宝
     */
    PAY_ALIPAY(2,"支付宝"),

    /**
     * 在线支付-微信支付
     */
    PAY_WEHCHAT(3,"微信支付"),

    /**
     * 在线支付-微信支付
     */
    PAY_BALANCE(4,"余额支付");

    private Integer id;
    private String desc;
    PaymentTypeEnum(Integer id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static PaymentTypeEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (PaymentTypeEnum type: PaymentTypeEnum.values()) {
            if (type.getId().intValue() == id) {
                return type;
            }
        }
        return null;
    }
}
